<?php
    require('../Utils.php');

    if(is_get()){
        getJson(500, '不支持get请求', null);
        return;
    }
    $post = getJsonParamter();

    $username = $post['username'];
    $password = $post['password'];

    $conn = getConnection();
    $sql = "INSERT INTO administrator(username, password) VALUES (?, ?)";
    
    $result = execute($conn, $sql, $username, $password);

    if($result){
        getJson(200, '注册成功', null);
    }else{
        getJson(500, '注册失败', null);
    }
?>